package thread;

import java.util.Scanner;

public class Demo17 {
    public static volatile int isQuit = 0;
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            while (isQuit == 0) {

            }
            System.out.println("t1退出！");
        });
        t1.start();
        Thread t2 = new Thread(() -> {
            System.out.println("请输入isQuit:");
            Scanner scanner = new Scanner(System.in);
            isQuit = scanner.nextInt();
        });
        t2.start();
    }
}
